package com.taplinker.client.receive;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.taplinker.app.LoginActivity;
import com.taplinker.client.AppConfigFactory;
import com.taplinker.client.core.TaplinkerApplication;
import com.taplinker.client.im.activity.IMQueueActivity;

public class PushMessageReceive extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {
		if(TaplinkerApplication.getInstance().isOpen()) {
			Intent pushIntent = new Intent(context,IMQueueActivity.class);
			pushIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			AppConfigFactory.getInstance().getApplication().startActivity(pushIntent);
		} else {
			Intent pushIntent = new Intent(context,LoginActivity.class);
			pushIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			AppConfigFactory.getInstance().getApplication().startActivity(pushIntent);
		}
	}

}

